const express = require('express');
const router = express.Router();
const notificationController = require('../controllers/notificationController');
const { authUser } = require('../middleware/auth');

router.use(authUser);

// 通知列表资源
router.get('/', notificationController.getNotifications);           // 获取通知列表
router.post('/', notificationController.createNotification);       // 创建通知
router.put('/batch/read', notificationController.markAllAsRead);    // 批量标记已读
router.delete('/clear', notificationController.deleteAllNotifications); // 删除所有通知

// 单个通知资源
router.put('/:id', notificationController.markAsRead);      // 标记单个已读

module.exports = router; 